//
//  WantViewController.m
//  YouGoWeGo
//
//  Created by Dai on 14/11/19.
//  Copyright (c) 2014年 LiuFei. All rights reserved.
//

#import "WantViewController.h"
#import "WantDetailViewController.h"
@interface WantViewController ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation WantViewController
- (void)dealloc
{
    [_table release];
    [_tableArray release];
    [_indexPath release];
    [_image release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.navigationController.navigationBar.translucent = NO;
    [self.navigationItem setTitle:@"想去的地方"];
    [self creatTable];
    
    
}
#pragma mark -
#pragma TableView
- (void)creatTable
{
    self.table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    [_table setBackgroundColor:[UIColor whiteColor]];
    _table.dataSource = self;
    _table.delegate = self;
    [self.view addSubview:_table];
    _table.rowHeight = 200;
    [_table release];
    
}
#pragma mark -
#pragma TableViewCell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentify = @"cellIdentify";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentify];
    if (!cell) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentify] autorelease];
        
    }
    self.image = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, self.view.frame.size.width - 20, 180)];
    [_image setBackgroundColor:[UIColor yellowColor]];
    [cell addSubview:_image];
    [_image release];
    return cell;
    
}
#pragma mark -
#pragma row数量
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5; //[_tableArray count];
    
}
#pragma mark -
#pragma 跳转
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //被取消选中状体
    self.indexPath = indexPath;
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    WantDetailViewController *detail = [[WantDetailViewController alloc] init];
    [self.navigationController pushViewController:detail animated:YES];
    [detail release];
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
